import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
// import App from '@/App'
import Layout from '@/views/rbac/layout'

import Roles from '@/views/rbac/roles'
import RolesList from '@/views/rbac/roles/roles'
import RolesCreate from '@/views/rbac/roles/create'
import RolesEdit from '@/views/rbac/roles/edit'

import Users from '@/views/rbac/users'
import UsersList from '@/views/rbac/users/users'
import UsersCreate from '@/views/rbac/users/create'
import UsersEdit from '@/views/rbac/users/edit'

import Admins from '@/views/rbac/admins'
import AdminsList from '@/views/rbac/admins/admins'
import AdminsCreate from '@/views/rbac/admins/create'
import AdminsEdit from '@/views/rbac/admins/edit'

import Permissions from '@/views/rbac/permissions'
import PermissionsList from '@/views/rbac/permissions/permissions'
import PermissionsCreate from '@/views/rbac/permissions/create'
import PermissionsEdit from '@/views/rbac/permissions/edit'

import Nodes from '@/views/rbac/nodes'
import NodesList from '@/views/rbac/nodes/nodes'
import NodesCreate from '@/views/rbac/nodes/create'
import NodesEdit from '@/views/rbac/nodes/edit'

import Systems from '@/views/rbac/systems'
import SystemsList from '@/views/rbac/systems/systems'
import SystemsCreate from '@/views/rbac/systems/create'
import SystemsEdit from '@/views/rbac/systems/edit'
import SystemsRoles from '@/views/rbac/systems/roles'
import SystemRolePermissions from '@/views/rbac/systems/permissions'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: Layout,
      children: [
        {
          path: 'hello',
          name: 'Hello',
          component: Hello
        },
        // 角色
        {
          path: 'roles',
          name: 'Roles',
          component: Roles,
          children: [
            {
              path: 'index', name: 'RolesList', component: RolesList
            },
            {
              path: 'create', name: 'RolesCreate', component: RolesCreate
            },
            {
              path: 'edit', name: 'RolesEdit', component: RolesEdit
            }
          ]
        },
        // 用户
        {
          path: 'users',
          name: 'Users',
          component: Users,
          children: [
            {
              path: 'index', name: 'UsersList', component: UsersList
            },
            {
              path: 'create', name: 'UsersCreate', component: UsersCreate
            },
            {
              path: 'edit', name: 'UsersEdit', component: UsersEdit
            }
          ]
        },
        // 管理员
        {
          path: 'admins',
          name: 'Admins',
          component: Admins,
          children: [
            {
              path: 'index', name: 'AdminsList', component: AdminsList
            },
            {
              path: 'create', name: 'AdminsCreate', component: AdminsCreate
            },
            {
              path: 'edit', name: 'AdminsEdit', component: AdminsEdit
            }
          ]
        },
        // 权限
        {
          path: 'permissions',
          name: 'Permissions',
          component: Permissions,
          children: [
            {
              path: 'index', name: 'PermissionsList', component: PermissionsList
            },
            {
              path: 'create', name: 'PermissionsCreate', component: PermissionsCreate
            },
            {
              path: 'edit', name: 'PermissionsEdit', component: PermissionsEdit
            }
          ]
        },
        // 系统
        {
          path: 'systems',
          name: 'Systems',
          component: Systems,
          children: [
            {
              path: 'index', name: 'SystemsList', component: SystemsList
            },
            {
              path: 'create', name: 'SystemsCreate', component: SystemsCreate
            },
            {
              path: 'edit', name: 'SystemsEdit', component: SystemsEdit
            },
            {
              path: ':system_key/roles', name: 'SystemsRoles', component: SystemsRoles
            },
            {
              path: ':system_key/roles/:role_id', name: 'SystemRolePermissions', component: SystemRolePermissions
            }
          ]
        },
        // 节点
        {
          path: 'nodes',
          name: 'Nodes',
          component: Nodes,
          children: [
            {
              path: 'index', name: 'NodesList', component: NodesList
            },
            {
              path: 'create', name: 'NodesCreate', component: NodesCreate
            },
            {
              path: 'edit', name: 'NodesEdit', component: NodesEdit
            }
          ]
        }
      ]
    }
  ]
})
